//
//  TheVillageCollectionViewCell.m
//  community
//
//  Created by 小崔 on 2020/5/29.
//  Copyright © 2020 小崔. All rights reserved.
//

#import "TheVillageCollectionViewCell.h"

@implementation TheVillageCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initUI];
    }
    return self;
}

- (void)initUI {
    [self addSubview:self.iconImage];
    [self addSubview:self.titleLable];
    WEAKSELF
    [self.iconImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.mas_left).offset(15);
        make.top.equalTo(weakSelf.mas_top);
        make.width.equalTo(@30);
        make.height.equalTo(@30);
    }];
    [self.titleLable mas_makeConstraints:^(MASConstraintMaker *make) {
          make.top.equalTo(weakSelf.iconImage.mas_bottom).offset(10);
          make.left.equalTo(weakSelf.iconImage.mas_left).offset(-10);
          make.width.equalTo(@70);
          make.height.equalTo(@36);
    }];
}
- (void)setModel:(NSString *)model{
    self.iconImage.image = [UIImage imageNamed:model];
}
- (void)setTitle:(NSString *)title{
    self.titleLable.text = title;
}
#pragma mark - 懒加载
- (UIImageView *)iconImage{
    if (!_iconImage) {
        self.iconImage = [[UIImageView alloc]init];
        _iconImage.backgroundColor = [UIColor redColor];
    }
    return _iconImage;
}
- (UILabel *)titleLable{
    if (!_titleLable) {
        self.titleLable = [[UILabel alloc]init];
        _titleLable.text = @"默认";
        _titleLable.font = SYSTEMFONT(15);
        _titleLable.numberOfLines = 2;
    }
    return _titleLable;
}

@end
